import LogicFlow, { RectNode, RectNodeModel } from "@logicflow/core";
import { RectResize } from "@logicflow/extension";

class CustomRectNode extends RectResize.view {}

class CustomRectModel extends RectResize.model {
  // 设置矩形的形状属性：大小和圆角
  initNodeData(data) {
    super.initNodeData(data);
    this.width = 100;
    this.height = 40;
    this.radius = 8;
    this.text.editable = false;
  }

  // 重写文本样式属性
  getTextStyle() {
    const style = super.getTextStyle();
    style.fontSize = 16;
    // 通过 transform 重新设置 text 的位置：向下移动70px
    return style;
  }
}

export default {
  type: "c-rect",
  view: CustomRectNode,
  model: CustomRectModel,
};
